package com.ea.common.SA;

import com.ea.common.SA.pojo.param.FaceCompareParam;
import com.ea.common.SA.pojo.param.PersonFaceIn;
import feign.form.FormData;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestPart;

@FeignClient(
        name = "face-reg",
        url = "${lb.url}/face-reg"
)
public interface FaceRegFeign {

    @PostMapping(
            value = "/FaceReg/uploadFace",
            consumes = MediaType.MULTIPART_FORM_DATA_VALUE
    )
    ResponseEntity<Result> uploadFace(
            @RequestPart(name = "faceIn") PersonFaceIn faceIn
    );

    @PostMapping(
            value = "/FaceReg/removeFace",
            consumes = MediaType.MULTIPART_FORM_DATA_VALUE
    )
    ResponseEntity<Result> removeFace(
            @RequestPart(name = "personFaceId") long personFaceId
    );

    @PostMapping(
            value = "/FaceReg/getAllFaces",
            consumes = MediaType.MULTIPART_FORM_DATA_VALUE
    )
    ResponseEntity<Result> getAllFaces();

    @PostMapping(
            value = "/FaceReg/detectPerson",
            consumes = MediaType.MULTIPART_FORM_DATA_VALUE
    )
    ResponseEntity<Result> detectPerson(
            @RequestPart(name = "image") FormData image
    );

    @PostMapping(
            value = "/FaceReg/personFaceExist",
            consumes = MediaType.MULTIPART_FORM_DATA_VALUE
    )
    ResponseEntity<Result> personFaceExist(
            @RequestPart("personId") long personId,
            @RequestPart(name = "image") FormData image
    );

    @PostMapping(
            value = "/FaceReg/detectPersonVideo",
            consumes = MediaType.MULTIPART_FORM_DATA_VALUE
    )
    ResponseEntity<Result> detectPersonVideo(
            @RequestPart(name = "video") FormData video
    );

    // 2024-1-14
    @PostMapping(
            value = "/FaceReg/maxFaceDetect",
            consumes = MediaType.MULTIPART_FORM_DATA_VALUE
    )
    ResponseEntity<Result> maxFaceDetect(
            @RequestPart(name = "image") FormData image
    );

    @PostMapping(
            value = "/FaceReg/faceCompare",
            consumes = MediaType.MULTIPART_FORM_DATA_VALUE
    )
    ResponseEntity<Result> faceCompare(
            @RequestPart(name = "faceCompareParam") FaceCompareParam faceCompareParam
    );

    @PostMapping(
            value = "/FaceReg/maxFaceDetectVideo",
            consumes = MediaType.MULTIPART_FORM_DATA_VALUE
    )
    ResponseEntity<Result> maxFaceDetectVideo(
            @RequestPart(name = "video") FormData video);

    @PostMapping(
            value = "/FaceReg/getFace",
            consumes = MediaType.MULTIPART_FORM_DATA_VALUE
    )
    ResponseEntity<Result> getFace(@RequestPart(name = "faceId") Long personFaceId);
}
